package org.stream.answerduel.vo.Message;

import com.alibaba.fastjson.JSON;
import lombok.Data;
import org.springframework.beans.BeanUtils;
import org.stream.answerduel.vo.UserVo;

/**
 * 功能描述：存储匹配消息的实体类
 *
 * @Auther: 苏建誉
 * @Date: 2019/7/11 22:48
 */
@Data
public class PvpMessage extends Message{
    /**
     * 对方玩家
     */
    private UserVo user;
    /**
     * 房间id
     */
    private String roomId;

    public PvpMessage(){
        super(Type.Pvp);
    }
    public PvpMessage(UserVo user,Long roomId){
        super(Type.Pvp);
        UserVo uesrVo=new UserVo();
        BeanUtils.copyProperties(user, uesrVo);
        this.user=uesrVo;
        this.roomId=roomId.toString();
    }
    @Override
    public String toString(){
        return JSON.toJSONString(this);
    }
}
